/**
 * 
 */
package jpa.service;

import java.util.List;

import jpa.daos.UserDao;
import jpa.entities.User;
import jpa.service.interfaces.UserManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;


@Repository("UserManager")
public class UserManagerImpl implements UserManager {	
	@Autowired
	UserDao userDao;

	/* (non-Javadoc)
	 * @see service.interfaces.UserManager#insertUser(entities.User)
	 */
	@Override
	@Transactional
	public Long insertUser(User user) {
		return userDao.insertUser(user);
	}

	/* (non-Javadoc)
	 * @see service.interfaces.UserManager#findAllUsers()
	 */
	@Override
	public List<User> findAllUsers() {
		return userDao.findAllUsers();
	}

	/* (non-Javadoc)
	 * @see service.interfaces.UserManager#delete(entities.User)
	 */
	@Override
	public void delete(User user) {
		userDao.delete(user);
	}

	/* (non-Javadoc)
	 * @see service.interfaces.UserManager#findById(entities.User)
	 */
	@Override
	public User findById(Long id) {
		return userDao.findById(id);
	}

	@Override
	public User findByUsername(String uname) {
		return userDao.findByUsername(uname);
	}

	@Override
	public User userExists(User user) {
		return userDao.userExists(user);
	}

	@Override
	public boolean usernameExists(String username) {
		return userDao.usernameExists(username);
	}

	@Override
	public Long getIdByUsername(String username) {
		return userDao.getIdByUsername(username);
	}

	@Override
	public User getUserByUsername(String username) {
		return userDao.getUserByUsername(username);
	}

	@Override
	public User findUser(User user) {
		return userDao.findUser(user);
	}

}
